<style type="text/css">

</style>
<template>
    <i-form ref="formValidate" :model="formValidate" :rules="ruleValidate" :label-width="80">
        <Form-item label="证件类型" prop="value">
            <i-input v-model="formValidate.value" placeholder="请输入证件类型"></i-input>
        </Form-item>
        <Form-item>
            <i-button @click="handleSubmit('formValidate')" type="primary">提交</i-button>
            <i-button type="ghost" style="margin-left: 8px">取消</i-button>
        </Form-item>
    </i-form>

</template>
<script>
    import apiUtil from '../../assets/utils/api_util';

    export default {
        data() {
            return {
                formValidate: {
                    //添加字段
                    value: '',
                },
                ruleValidate: {
                    value: [
                        {required: true, message: '证件类型不能为空', trigger: 'blur'}
                    ],
                },
                papertypeArr:[],
            }
        },
        mounted: function () {

        },

        methods: {
            //添加
            handleSubmit(name) {

                let that = this;
                let model = this.$refs[name].model;
                this.$refs[name].validate((valid) => {
                    that.addData(model);
                })
            },
            addData: function (model) {
                let that = this;

                let params = that.$qs.stringify(model);
                this.$Loading.start();

                apiUtil.post(that,apiUtil.urls.paperTypeCreate, params, function (res) {
                    that.$Loading.finish();

                });
            },

            uploadList() {
                let that = this;
                this.imageList = that.$refs.upload ? that.$refs.upload.fileList : [];
                console.log('this.imageList:', this.imageList);
                // return ;
            },

        }
    }
</script>
